﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Torimi.Wiki.Interfaces;

namespace Torimi.Wiki.Services
{
	/// <summary>
	/// A memory logger, for use when a more permanent store is not available.
	/// </summary>
	public class MemoryLogger : ILogger
	{
		private List<string> _warning = new List<string>();
		private List<string> _error = new List<string>();
		private List<string> _information = new List<string>();
		private List<string> _fatal = new List<string>();

		/// <summary>
		/// Logs the warning.
		/// </summary>
		/// <param name="message">The message.</param>
		public void LogWarning(string message)
		{
			_warning.Add(message);
		}

		/// <summary>
		/// Logs the error.
		/// </summary>
		/// <param name="message">The message.</param>
		public void LogError(string message)
		{
			_error.Add(message);
		}

		/// <summary>
		/// Logs the information.
		/// </summary>
		/// <param name="message">The message.</param>
		public void LogInformation(string message)
		{
			_information.Add(message);
		}

		/// <summary>
		/// Logs the fatal.
		/// </summary>
		/// <param name="message">The message.</param>
		public void LogFatal(string message)
		{
			_fatal.Add(message);
		}

		/// <summary>
		/// Logs the error.
		/// </summary>
		/// <param name="exception">The exception.</param>
		public void LogError(Exception exception)
		{
			_error.Add(exception.ToString());
		}
	}
}
